using SharpGraphT.Sharp.System.Collections.Generic;

namespace SharpGraphT.Graph.Specifics;

[Serializable]
public class DirectedEdgeContainer<TV, TE> {
    private static readonly long SerialVersionUid = 7494242245729767106L;

    internal IReadOnlyableSet<TE> Incoming { get; set; }
    internal IReadOnlyableSet<TE> Outgoing { get; set; }

    internal DirectedEdgeContainer(IEdgeSetFactory<TV, TE> edgeSetFactory,
        TV vertex) {
        Incoming = edgeSetFactory.CreateEdgeSet(vertex);
        Outgoing = edgeSetFactory.CreateEdgeSet(vertex);
    }

    public IReadOnlySet<TE> GetUnmodifiableIncomingEdges() => Incoming;

    public IReadOnlySet<TE> GetUnmodifiableOutgoingEdges() => Outgoing;

    public void AddIncomingEdge(TE e) => Incoming.Add(e);

    public void AddOutgoingEdge(TE e) => Outgoing.Add(e);

    public void RemoveIncomingEdge(TE e) => Incoming.Remove(e);

    public void RemoveOutgoingEdge(TE e) => Outgoing.Remove(e);
}